package com.zmj.sy.mom.srv.aps.controller;

import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseIdReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseIdsReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseListResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.pick.*;
import com.zmj.sy.mom.srv.aps.service.PickService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

@RequiredArgsConstructor
@Api(tags = "领料")
@RestController
@RequestMapping("/pick")
public class PickController {

    private final PickService pickService;

    @ApiOperation("领料单 - 钢板领料单列表")
    @GetMapping("/plateList")
    public BaseListResVo<PickPlateListResVo> plateList(PickPlateListReqVo reqVo) {
        return pickService.plateList(reqVo);
    }

    @ApiOperation("领料单 - 添加钢板领料单")
    @PostMapping("/plateAdd")
    public PickPlateAddResVo plateAdd(@RequestBody PickPlateAddReqVo reqVo) {
        Integer id = pickService.plateAdd(reqVo);
        PickPlateAddResVo pickPlateAddResVo = new PickPlateAddResVo();
        pickPlateAddResVo.setId(id);
        return pickPlateAddResVo;
    }

    @ApiOperation("领料单 - 删除钢板领料单")
    @PostMapping("/plateDel")
    public BaseResVo plateDel(@RequestBody BaseIdReqVo reqVo) {
        pickService.plateDel(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("领料单 - 绑定钢板")
    @PostMapping("/plateBind")
    public BaseResVo plateBind(@RequestBody PickPlateBindReqVo reqVo) {
        pickService.plateBind(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("领料单 - 解绑钢板")
    @PostMapping("/plateUnbind")
    public BaseResVo plateUnbind(@RequestBody PickPlateUnbindReqVo reqVo) {
        pickService.plateUnbind(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("领料单 - 某个领料单下的钢板列表")
    @GetMapping("/plateBindList")
    public BaseListResVo<PickPlateBindListResVo> plateBindList( BaseIdReqVo reqVo) {
        return pickService.plateBindList(reqVo);
    }

    @ApiOperation("领料单 - 推送领料单")
    @PostMapping("/plateSend")
    public BaseResVo plateSend(@RequestBody BaseIdReqVo reqVo) {
        pickService.plateSend(reqVo);
        return BaseResVo.ok();
    }
    @ApiOperation("推送普达系统图纸")
    @PostMapping("/plateSendPd")
    public BaseResVo plateSendPd(String  pickingListNo,String plateCode) {
        pickService.plateSendPd( pickingListNo, plateCode);
        return BaseResVo.ok();
    }

    @ApiOperation("领料单 - 钢板移动工作组")
    @PostMapping("/plateGroup")
    public BaseResVo plateGroup(@RequestBody PickPlateGroupReqVo reqVo) {
        pickService.plateGroup(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("领料单 - 钢板移动位置")
    @PostMapping("/plateMove")
    public BaseResVo plateMove(@RequestBody PickPlateUpReqVo reqVo) {
        pickService.plateMove(reqVo);
        return BaseResVo.ok();
    }

    @ApiOperation("领料单 - 钢板计划切割时长")
    @GetMapping("/cutTime")
    public PickCutTimeResVo cutTime(BaseIdsReqVo reqVo) {
        return pickService.cutTime(reqVo);
    }
}
